<?php
$g4_path = '../../';
require_once ($g4_path.'lib.php');
require_once ($g4_path.'common.php');
require_once ('../teacher.lib.php');

header("Content-Type: text/html; charset=UTF-8");

$cate1 = $_REQUEST['cate1'];
$event_id = $_REQUEST['event_id'];
        
$_explain = "--선택해주세요--";
$_nodata = "--수강중인 학생이 없습니다--";

switch($event_id) {
        case 'cate1':
        $_catesql = "SELECT m.mb_name as v, c.student as n FROM course_order c, g4_member m WHERE c.course='$cate1' AND c.student=m.mb_no GROUP BY m.mb_no";
        $change_id = 'cate2';
        break;
}

$list = fetchAll2($_catesql);
array_unshift($list, array('',$_explain));

if(sizeof($list) == 1) {
        echo json_encode2(array('change_id'=>$change_id,'list'=>array(array('',$_nodata))));
        exit;
}

if($change_id != '') {
        echo json_encode2(array('change_id'=>$change_id,'list'=>$list));
}
